package com.woniu.utils;

import java.lang.reflect.Method;

/**
 * @program: bzeducation
 * @author: Xingqilin
 * @create: 2020-07-22 11:03
 * @description:生成redisKey工具
 */

public class RedisUtil {
    public static String generate(String namespace, Object target, Method method, Object... params) {
        StringBuilder sBuilder = new StringBuilder();
        sBuilder.append(namespace);
        sBuilder.append("::");
        sBuilder.append(target.getClass().getName());
        sBuilder.append(".");
        sBuilder.append(method.getName());    //生成key
        for (Object object : params) {
            sBuilder.append(".");
            sBuilder.append(object.toString());
        }
        return sBuilder.toString();
    }
}
